{extend name="layout/main" /}

{block name="header"}

{/block}

{block name="content"}
<style type="text/css">
    .link-th{
        color:blue;
    }
</style>
<section class="panel">
    <header class="panel-heading">
        <h4>会员列表</h4>
    </header>
    <div class="panel-body" style="padding-bottom: 50px">
        <form class="form-horizontal" action="">
            <div class="form-group">
                <div class="col-xs-1 no-pd-r">
                    <select name="type" id="type" class="form-control">
                        <option {if $Request.get.type == 'mobile'} selected {/if} value="mobile">会员账号</option>
                    </select>
                </div>
                <div class="col-xs-3 no-pd-l">
                    <input type="text" id="keyword" value="{$Request.get.keyword}" name="keyword" class="form-control" placeholder="请输入关键词搜索">
                </div>
                <!--<div class="col-xs-3 no-pd-l">
                    <input type="number" value="{$Request.get.page}" name="page" class="form-control" placeholder="请输入页码">
                </div>-->
                <button type="submit" class="btn btn-color">搜索</button>
                <!--<a type="button" href="{:url('admin/Excelexport/account_pos')}" class="btn btn-info">导出</a>-->
            </div>
        </form>
        <table class="table table-bordered table-striped no-margin">
            <thead>
            <tr>
                <th class="text-center">用户</th>
                <th class="text-center">总预安装</th>
                <th class="text-center">剩余预安装</th>
                <th class="text-center">已绑定名下机器</th>
                <th class="text-center">操作</th>
            </tr>

            </thead>
            <tbody>
            {if !empty($list)}
                {foreach $list as $entity}
                <tr>
                    <td style="vertical-align: middle" class="text-center">
                        {$entity.mobile}
                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        {$entity.sum_number}

                    </td>

                    <td style="vertical-align: middle" class="text-center">
                        {$entity.preinstall}
                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        {$entity.is_bind}
                    </td>

                    <td style="vertical-align: middle" class="text-center">
                        <a class="btn btn-xs btn-info" href="{:url('account_pos_day')}?id={$entity.user_id}">每天名下激活</a>
                        <br/>
                        <br/>
                        <a class="btn btn-xs btn-primary" href="{:url('snList')}?type=p_mobile&keyword={$entity.mobile}">查看用户已激活</a>
                        <br/>
                        <br/>
                        <a class="btn btn-xs btn-info" href="{:url('index')}?type=mobile&search={$entity.mobile}">查看用户pos机订单</a>
                    </td>
                </tr>
                {/foreach}
            {else /}
            <tr class="text-center">
                <td colspan="9">暂无数据</td>
            </tr>
            {/if}
            </tbody>
        </table>
        <div class="page">
            {:htmlspecialchars_decode($list->render())}
        </div>
    </div>
</section>
{/block}
{block name="footer"}
<script>

    function bindNext(id){
        var mobile=prompt("请输入用户手机");
        if (mobile!=null && mobile!=""){
            $.post('{:url("bindNext")}',{id:id,mobile:mobile},function(res){
                if(res.code == 0){
                    window.location.reload();
                }else{
                    alert(res.message)
                }
            })
        }
    }
    function unbindNext(id){
        if(window.confirm('确定要解绑吗？')) {
            $.post('{:url("unbindNext")}', {id: id}, function (res) {
                if (res.code == 0) {
                    window.location.reload();
                } else {
                    alert(res.message)
                }
            })
        }
    }

    function bind(id){
        var mobile=prompt("请输入用户手机");
        if (mobile!=null && mobile!=""){
            $.post('{:url("bindSnId")}',{id:id,mobile:mobile},function(res){
                if(res.code == 0){
                    window.location.reload();
                }else{
                    alert(res.message)
                }
            })
        }
    }
    function unbind(id){

        if(window.confirm('确定要解绑吗？')) {
            $.post('{:url("unbindSnId")}', {id: id}, function (res) {
                if (res.code == 0) {
                    window.location.reload();
                } else {
                    alert(res.message)
                }
            })
        }
    }
</script>

{/block}
